<div class="layui-fluid layui-anim website-anim-up" id="website-review-class-detail" lay-title="查看评审信息">
    <div class="layui-row layui-col-space8 website-container">
        <div class="layui-col-md10 layui-col-sm10 layui-col-xs10">
            <div class="layui-card" id="review-common">
                <div class="layui-card-header">基本情况</div>
                <div class="layui-card-body layui-form-item">
                    <div class="layui-row">
                        <!-- 基本信息-->
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">课题名称：</div>
                            <div class="layui-col-xs8 layui-col-sm8 layui-col-md8">[[${result != null ? result.name
                                :''}]]
                            </div>
                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">选题名称：</div>
                            <div id="topicCode" class="layui-col-xs8 layui-col-sm8 layui-col-md8">[[${result != null ?
                                result.Topic.topicName :''}]]
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">成果形式：</div>
                            <div id="achievementFormTypeCode" class="layui-col-xs8 layui-col-sm8 layui-col-md8"></div>
                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">
                            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">成果字数：</div>
                            <div class="layui-col-xs8 layui-col-sm8 layui-col-md8">[[${result != null ?
                                result.achievementFormSize :''}]]万字
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">学科分类：</div>
                            <div id="subjectTypeCode" class="layui-col-xs8 layui-col-sm8 layui-col-md8"></div>

                        </div>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5 layui-col-md-offset1 layui-col-lg-offset1">

                            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">研究类型：</div>
                            <div id="researchTypeCode" class="layui-col-xs8 layui-col-sm8 layui-col-md8"></div>

                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md5">
                            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">匿名附件：</div>
                            <div class="layui-col-xs8 layui-col-sm8 layui-col-md8">
                                <a id="upload-file-anonymous-a"></a>
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md12">
                            <div class="layui-col-xs4 layui-col-sm4 layui-col-md4">课题研究情况：</div>
                            <textarea class="layui-textarea layui-disabled" name="researchContent" readonly
                                      autocomplete="off">[[${result != null ? result.researchContent :''}]]</textarea>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-header">评审结果</div>
                <div class="layui-card-body layui-form-item" id="review-result">
                    <div class="layui-row">
                        <table lay-filter="reviewResultTable" id="reviewResultTable"
                               lay-data="{id: 'reviewResultTable'}"></table>
                    </div>
                    <div class="layui-row">
                        <label class="layui-form-label layui-form-label-two">评审意见：</label>
                        <div class="layui-inline layui-col-xs5 layui-col-sm5 layui-col-md12">
                                <textarea class="layui-textarea" id="researchContent" name="researchContent"
                                          autocomplete="off" readonly>[[${opinion != null ? opinion
                                :''}]]</textarea>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-row">
                <button class="layui-btn layui-btn-warm" id="clean">返回</button>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="score">
    {{#  if(d.indicatorType && d.score){ }}
    <span>{{d.indicatorType +'-' + d.score}}</span>
    {{#  } }}
</script>
<script data-th-inline="javascript" type="text/javascript">
    layui.use(['jquery', 'laydate', 'form', 'website', 'dict'], function () {
        let $ = layui.jquery,
            laydate = layui.laydate,
            website = layui.website,
            form = layui.form,
            view = layui.view,
            $view = $('#website-review-class-detail'),
            $reviewView = $('#review-result'),
            result = [[${result}]],
            reviewId = [[${reviewId}]],
            reviewResultTable,
            $clean = $('#clean');
        $clean.on('click', function () {
            let currentUrl = window.location.hash.replace('#', '');
            website.view.tab.del(currentUrl);
            window.location.reload();
        })
        initForm()
        initReviewResultTable()

        function initForm() {
            if (result) {
                if (result.anonymousFileId) {
                    $("#upload-file-anonymous-a").text('点击下载');
                    $("#upload-file-anonymous-a")[0].setAttribute('href', ctx + 'download/' + result.anonymousFileId)
                } else {
                    $("#upload-file-anonymous-a").text('无附件');
                }
                $("#achievementFormTypeCode").text(result.achievementFormTypeCode ? achievementFormTypeCodeName(result.achievementFormTypeCode) : '');
                $("#subjectTypeCode").text(result.subjectTypeCode ? layui.dict.getByCode(result.subjectTypeCode).name : '');
                $("#researchTypeCode").text(result.researchTypeCode ? layui.dict.getByCode(result.researchTypeCode).name : '');
            }
        }

        function achievementFormTypeCodeName(data) {
            let dicts = layui.dict.getByCodes(data.split(','))
            let name = ''
            for (let i = 0; i < dicts.length; i++) {
                name += dicts[i].name + ','
            }
            return name
        }


        function initReviewResultTable() {
            reviewResultTable = website.table.init({
                elem: $reviewView.find('table'),
                id: 'reviewResultTable',
                url: ctx + 'review/getScoreLogById/' + reviewId,
                cols: [
                    [
                        {type: 'numbers', title: '序号'},
                        {field: 'indicatorDescription', title: '指标'},
                        {field: 'weight', title: '权重'},
                        {title: '您的评分结果', templet: '#score'},
                    ]
                ]
            });
        }

    })


</script>